<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>淡入效果的实现</title>
</head>
<body>
<div id="app">
    <h1 v-bind:style="status">Hello, World!</h1>
</div>

<script type="module">
    import {createApp, ref, reactive} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                let count = ref(0)
                let opacity = ref(0)

                let status = reactive({
                    opacity: 0
                })

                let interval = setInterval(
                    () => {
                        count.value += 1
                        if (count.value === 100) {
                            clearInterval(interval)
                        } else {
                            opacity.value += 0.01
                            status.opacity = opacity.value
                        }
                    },
                    100
                );

                return {
                    status,
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>